3.1.47 \(\int \csc ^3(e+f x) (a+b \tan ^2(e+f x))^2 \, dx\) [47]

3.1.47.1 Optimal result
3.1.47.2 Mathematica [B] (verified)
3.1.47.3 Rubi [A] (verified)
3.1.47.4 Maple [A] (verified)
3.1.47.5 Fricas [B] (verification not implemented)
3.1.47.6 Sympy [F]
3.1.47.7 Maxima [A] (verification not implemented)
3.1.47.8 Giac [B] (verification not implemented)
3.1.47.9 Mupad [B] (verification not implemented)

3.1.47.1 Optimal result

Integrand size = 23, antiderivative size = 82 \[ \int \csc ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx=-\frac {a (a+4 b) \text {arctanh}(\cos (e+f x))}{2 f}+\frac {a (a+4 b) \sec (e+f x)}{2 f}-\frac {a^2 \csc ^2(e+f x) \sec (e+f x)}{2 f}+\frac {b^2 \sec ^3(e+f x)}{3 f} \]

output
-1/2*a*(a+4*b)*arctanh(cos(f*x+e))/f+1/2*a*(a+4*b)*sec(f*x+e)/f-1/2*a^2*cs 
c(f*x+e)^2*sec(f*x+e)/f+1/3*b^2*sec(f*x+e)^3/f
 
3.1.47.2 Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(376\) vs. \(2(82)=164\).

Time = 6.90 (sec) , antiderivative size = 376, normalized size of antiderivative = 4.59 \[ \int \csc ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx=-\frac {a^2 \csc ^2\left (\frac {1}{2} (e+f x)\right )}{8 f}+\frac {\left (-a^2-4 a b\right ) \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )}{2 f}+\frac {\left (a^2+4 a b\right ) \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )}{2 f}+\frac {a^2 \sec ^2\left (\frac {1}{2} (e+f x)\right )}{8 f}+\frac {b^2}{12 f \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )^2}+\frac {b^2 \sin \left (\frac {1}{2} (e+f x)\right )}{6 f \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )^3}-\frac {b^2 \sin \left (\frac {1}{2} (e+f x)\right )}{6 f \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )^3}+\frac {b^2}{12 f \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )^2}+\frac {-12 a b \sin \left (\frac {1}{2} (e+f x)\right )-b^2 \sin \left (\frac {1}{2} (e+f x)\right )}{6 f \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )}+\frac {12 a b \sin \left (\frac {1}{2} (e+f x)\right )+b^2 \sin \left (\frac {1}{2} (e+f x)\right )}{6 f \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )} \]

input
Integrate[Csc[e + f*x]^3*(a + b*Tan[e + f*x]^2)^2,x]
 
output
-1/8*(a^2*Csc[(e + f*x)/2]^2)/f + ((-a^2 - 4*a*b)*Log[Cos[(e + f*x)/2]])/( 
2*f) + ((a^2 + 4*a*b)*Log[Sin[(e + f*x)/2]])/(2*f) + (a^2*Sec[(e + f*x)/2] 
^2)/(8*f) + b^2/(12*f*(Cos[(e + f*x)/2] - Sin[(e + f*x)/2])^2) + (b^2*Sin[ 
(e + f*x)/2])/(6*f*(Cos[(e + f*x)/2] - Sin[(e + f*x)/2])^3) - (b^2*Sin[(e 
+ f*x)/2])/(6*f*(Cos[(e + f*x)/2] + Sin[(e + f*x)/2])^3) + b^2/(12*f*(Cos[ 
(e + f*x)/2] + Sin[(e + f*x)/2])^2) + (-12*a*b*Sin[(e + f*x)/2] - b^2*Sin[ 
(e + f*x)/2])/(6*f*(Cos[(e + f*x)/2] + Sin[(e + f*x)/2])) + (12*a*b*Sin[(e 
 + f*x)/2] + b^2*Sin[(e + f*x)/2])/(6*f*(Cos[(e + f*x)/2] - Sin[(e + f*x)/ 
2]))
 
3.1.47.3 Rubi [A] (verified)

Time = 0.28 (sec) , antiderivative size = 78, normalized size of antiderivative = 0.95, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.261, Rules used = {3042, 4147, 366, 363, 262, 219}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \csc ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\left (a+b \tan (e+f x)^2\right )^2}{\sin (e+f x)^3}dx\)

\(\Big \downarrow \) 4147

\(\displaystyle \frac {\int \frac {\sec ^2(e+f x) \left (b \sec ^2(e+f x)+a-b\right )^2}{\left (1-\sec ^2(e+f x)\right )^2}d\sec (e+f x)}{f}\)

\(\Big \downarrow \) 366

\(\displaystyle \frac {\frac {a^2 \sec ^3(e+f x)}{2 \left (1-\sec ^2(e+f x)\right )}-\frac {1}{2} \int \frac {\sec ^2(e+f x) \left (a^2+4 b a-2 b^2+2 b^2 \sec ^2(e+f x)\right )}{1-\sec ^2(e+f x)}d\sec (e+f x)}{f}\)

\(\Big \downarrow \) 363

\(\displaystyle \frac {\frac {1}{2} \left (\frac {2}{3} b^2 \sec ^3(e+f x)-a (a+4 b) \int \frac {\sec ^2(e+f x)}{1-\sec ^2(e+f x)}d\sec (e+f x)\right )+\frac {a^2 \sec ^3(e+f x)}{2 \left (1-\sec ^2(e+f x)\right )}}{f}\)

\(\Big \downarrow \) 262

\(\displaystyle \frac {\frac {1}{2} \left (\frac {2}{3} b^2 \sec ^3(e+f x)-a (a+4 b) \left (\int \frac {1}{1-\sec ^2(e+f x)}d\sec (e+f x)-\sec (e+f x)\right )\right )+\frac {a^2 \sec ^3(e+f x)}{2 \left (1-\sec ^2(e+f x)\right )}}{f}\)

\(\Big \downarrow \) 219

\(\displaystyle \frac {\frac {a^2 \sec ^3(e+f x)}{2 \left (1-\sec ^2(e+f x)\right )}+\frac {1}{2} \left (\frac {2}{3} b^2 \sec ^3(e+f x)-a (a+4 b) (\text {arctanh}(\sec (e+f x))-\sec (e+f x))\right )}{f}\)

input
Int[Csc[e + f*x]^3*(a + b*Tan[e + f*x]^2)^2,x]
 
output
((a^2*Sec[e + f*x]^3)/(2*(1 - Sec[e + f*x]^2)) + (-(a*(a + 4*b)*(ArcTanh[S 
ec[e + f*x]] - Sec[e + f*x])) + (2*b^2*Sec[e + f*x]^3)/3)/2)/f
 

3.1.47.3.1 Defintions of rubi rules used

rule 219
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* 
ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt 
Q[a, 0] || LtQ[b, 0])
 

rule 262
Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[c*(c*x) 
^(m - 1)*((a + b*x^2)^(p + 1)/(b*(m + 2*p + 1))), x] - Simp[a*c^2*((m - 1)/ 
(b*(m + 2*p + 1)))   Int[(c*x)^(m - 2)*(a + b*x^2)^p, x], x] /; FreeQ[{a, b 
, c, p}, x] && GtQ[m, 2 - 1] && NeQ[m + 2*p + 1, 0] && IntBinomialQ[a, b, c 
, 2, m, p, x]
 

rule 363
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_.)*((c_) + (d_.)*(x_)^2), x 
_Symbol] :> Simp[d*(e*x)^(m + 1)*((a + b*x^2)^(p + 1)/(b*e*(m + 2*p + 3))), 
 x] - Simp[(a*d*(m + 1) - b*c*(m + 2*p + 3))/(b*(m + 2*p + 3))   Int[(e*x)^ 
m*(a + b*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, m, p}, x] && NeQ[b*c - a*d 
, 0] && NeQ[m + 2*p + 3, 0]
 

rule 366
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2)^2, 
x_Symbol] :> Simp[(-(b*c - a*d)^2)*(e*x)^(m + 1)*((a + b*x^2)^(p + 1)/(2*a* 
b^2*e*(p + 1))), x] + Simp[1/(2*a*b^2*(p + 1))   Int[(e*x)^m*(a + b*x^2)^(p 
 + 1)*Simp[(b*c - a*d)^2*(m + 1) + 2*b^2*c^2*(p + 1) + 2*a*b*d^2*(p + 1)*x^ 
2, x], x], x] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b*c - a*d, 0] && LtQ[p 
, -1]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4147
Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^2)^ 
(p_.), x_Symbol] :> With[{ff = FreeFactors[Sec[e + f*x], x]}, Simp[1/(f*ff^ 
m)   Subst[Int[(-1 + ff^2*x^2)^((m - 1)/2)*((a - b + b*ff^2*x^2)^p/x^(m + 1 
)), x], x, Sec[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[( 
m - 1)/2]
 
3.1.47.4 Maple [A] (verified)

Time = 0.59 (sec) , antiderivative size = 85, normalized size of antiderivative = 1.04

method result size
derivativedivides \(\frac {a^{2} \left (-\frac {\csc \left (f x +e \right ) \cot \left (f x +e \right )}{2}+\frac {\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )+2 a b \left (\frac {1}{\cos \left (f x +e \right )}+\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )\right )+\frac {b^{2}}{3 \cos \left (f x +e \right )^{3}}}{f}\) \(85\)
default \(\frac {a^{2} \left (-\frac {\csc \left (f x +e \right ) \cot \left (f x +e \right )}{2}+\frac {\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )+2 a b \left (\frac {1}{\cos \left (f x +e \right )}+\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )\right )+\frac {b^{2}}{3 \cos \left (f x +e \right )^{3}}}{f}\) \(85\)
risch \(\frac {{\mathrm e}^{i \left (f x +e \right )} \left (3 a^{2} {\mathrm e}^{8 i \left (f x +e \right )}+12 a b \,{\mathrm e}^{8 i \left (f x +e \right )}+12 a^{2} {\mathrm e}^{6 i \left (f x +e \right )}+8 b^{2} {\mathrm e}^{6 i \left (f x +e \right )}+18 a^{2} {\mathrm e}^{4 i \left (f x +e \right )}-24 a b \,{\mathrm e}^{4 i \left (f x +e \right )}-16 b^{2} {\mathrm e}^{4 i \left (f x +e \right )}+12 a^{2} {\mathrm e}^{2 i \left (f x +e \right )}+8 b^{2} {\mathrm e}^{2 i \left (f x +e \right )}+3 a^{2}+12 a b \right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )^{2} \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right )}{2 f}-\frac {2 a \ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right ) b}{f}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right )}{2 f}+\frac {2 a \ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right ) b}{f}\) \(276\)

input
int(csc(f*x+e)^3*(a+b*tan(f*x+e)^2)^2,x,method=_RETURNVERBOSE)
 
output
1/f*(a^2*(-1/2*csc(f*x+e)*cot(f*x+e)+1/2*ln(csc(f*x+e)-cot(f*x+e)))+2*a*b* 
(1/cos(f*x+e)+ln(csc(f*x+e)-cot(f*x+e)))+1/3*b^2/cos(f*x+e)^3)
 
3.1.47.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 168 vs. \(2 (74) = 148\).

Time = 0.29 (sec) , antiderivative size = 168, normalized size of antiderivative = 2.05 \[ \int \csc ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx=\frac {6 \, {\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{4} - 4 \, {\left (6 \, a b - b^{2}\right )} \cos \left (f x + e\right )^{2} - 4 \, b^{2} - 3 \, {\left ({\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{5} - {\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{3}\right )} \log \left (\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) + 3 \, {\left ({\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{5} - {\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{3}\right )} \log \left (-\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right )}{12 \, {\left (f \cos \left (f x + e\right )^{5} - f \cos \left (f x + e\right )^{3}\right )}} \]

input
integrate(csc(f*x+e)^3*(a+b*tan(f*x+e)^2)^2,x, algorithm="fricas")
 
output
1/12*(6*(a^2 + 4*a*b)*cos(f*x + e)^4 - 4*(6*a*b - b^2)*cos(f*x + e)^2 - 4* 
b^2 - 3*((a^2 + 4*a*b)*cos(f*x + e)^5 - (a^2 + 4*a*b)*cos(f*x + e)^3)*log( 
1/2*cos(f*x + e) + 1/2) + 3*((a^2 + 4*a*b)*cos(f*x + e)^5 - (a^2 + 4*a*b)* 
cos(f*x + e)^3)*log(-1/2*cos(f*x + e) + 1/2))/(f*cos(f*x + e)^5 - f*cos(f* 
x + e)^3)
 
3.1.47.6 Sympy [F]

\[ \int \csc ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx=\int \left (a + b \tan ^{2}{\left (e + f x \right )}\right )^{2} \csc ^{3}{\left (e + f x \right )}\, dx \]

input
integrate(csc(f*x+e)**3*(a+b*tan(f*x+e)**2)**2,x)
 
output
Integral((a + b*tan(e + f*x)**2)**2*csc(e + f*x)**3, x)
 
3.1.47.7 Maxima [A] (verification not implemented)

Time = 0.34 (sec) , antiderivative size = 111, normalized size of antiderivative = 1.35 \[ \int \csc ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx=-\frac {3 \, {\left (a^{2} + 4 \, a b\right )} \log \left (\cos \left (f x + e\right ) + 1\right ) - 3 \, {\left (a^{2} + 4 \, a b\right )} \log \left (\cos \left (f x + e\right ) - 1\right ) - \frac {2 \, {\left (3 \, {\left (a^{2} + 4 \, a b\right )} \cos \left (f x + e\right )^{4} - 2 \, {\left (6 \, a b - b^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, b^{2}\right )}}{\cos \left (f x + e\right )^{5} - \cos \left (f x + e\right )^{3}}}{12 \, f} \]

input
integrate(csc(f*x+e)^3*(a+b*tan(f*x+e)^2)^2,x, algorithm="maxima")
 
output
-1/12*(3*(a^2 + 4*a*b)*log(cos(f*x + e) + 1) - 3*(a^2 + 4*a*b)*log(cos(f*x 
 + e) - 1) - 2*(3*(a^2 + 4*a*b)*cos(f*x + e)^4 - 2*(6*a*b - b^2)*cos(f*x + 
 e)^2 - 2*b^2)/(cos(f*x + e)^5 - cos(f*x + e)^3))/f
 
3.1.47.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 236 vs. \(2 (74) = 148\).

Time = 0.64 (sec) , antiderivative size = 236, normalized size of antiderivative = 2.88 \[ \int \csc ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx=-\frac {\frac {3 \, a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - 6 \, {\left (a^{2} + 4 \, a b\right )} \log \left (\frac {{\left | -\cos \left (f x + e\right ) + 1 \right |}}{{\left | \cos \left (f x + e\right ) + 1 \right |}}\right ) - \frac {3 \, {\left (a^{2} - \frac {2 \, a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {8 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1}\right )} {\left (\cos \left (f x + e\right ) + 1\right )}}{\cos \left (f x + e\right ) - 1} - \frac {16 \, {\left (6 \, a b + b^{2} + \frac {12 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {6 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {3 \, b^{2} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )}}{{\left (\frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 1\right )}^{3}}}{24 \, f} \]

input
integrate(csc(f*x+e)^3*(a+b*tan(f*x+e)^2)^2,x, algorithm="giac")
 
output
-1/24*(3*a^2*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) - 6*(a^2 + 4*a*b)*log(a 
bs(-cos(f*x + e) + 1)/abs(cos(f*x + e) + 1)) - 3*(a^2 - 2*a^2*(cos(f*x + e 
) - 1)/(cos(f*x + e) + 1) - 8*a*b*(cos(f*x + e) - 1)/(cos(f*x + e) + 1))*( 
cos(f*x + e) + 1)/(cos(f*x + e) - 1) - 16*(6*a*b + b^2 + 12*a*b*(cos(f*x + 
 e) - 1)/(cos(f*x + e) + 1) + 6*a*b*(cos(f*x + e) - 1)^2/(cos(f*x + e) + 1 
)^2 + 3*b^2*(cos(f*x + e) - 1)^2/(cos(f*x + e) + 1)^2)/((cos(f*x + e) - 1) 
/(cos(f*x + e) + 1) + 1)^3)/f
 
3.1.47.9 Mupad [B] (verification not implemented)

Time = 11.31 (sec) , antiderivative size = 188, normalized size of antiderivative = 2.29 \[ \int \csc ^3(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx=\frac {\ln \left (\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )\,\left (\frac {a^2}{2}+2\,b\,a\right )}{f}+\frac {a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2}{8\,f}-\frac {{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4\,\left (\frac {3\,a^2}{2}+32\,b\,a\right )-{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6\,\left (\frac {a^2}{2}+16\,a\,b+8\,b^2\right )-{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\,\left (\frac {3\,a^2}{2}+16\,a\,b+\frac {8\,b^2}{3}\right )+\frac {a^2}{2}}{f\,\left (-4\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^8+12\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6-12\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4+4\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\right )} \]

input
int((a + b*tan(e + f*x)^2)^2/sin(e + f*x)^3,x)
 
output
(log(tan(e/2 + (f*x)/2))*(2*a*b + a^2/2))/f + (a^2*tan(e/2 + (f*x)/2)^2)/( 
8*f) - (tan(e/2 + (f*x)/2)^4*(32*a*b + (3*a^2)/2) - tan(e/2 + (f*x)/2)^6*( 
16*a*b + a^2/2 + 8*b^2) - tan(e/2 + (f*x)/2)^2*(16*a*b + (3*a^2)/2 + (8*b^ 
2)/3) + a^2/2)/(f*(4*tan(e/2 + (f*x)/2)^2 - 12*tan(e/2 + (f*x)/2)^4 + 12*t 
an(e/2 + (f*x)/2)^6 - 4*tan(e/2 + (f*x)/2)^8))